#ifndef FPLAYER_MEDIADEFINE_H
#define FPLAYER_MEDIADEFINE_H

#include "CommonDefine.h"
#include "FFMpegHeader.h"
#include "MediaConvert.h"

//枚举 音视频类型
enum MediaType {
  MediaType_Video = 0b0001,  //视频
  MediaType_Audio = 0b0010,  //音频
};

//枚举 媒体原始数据类型
enum MediaRawType {
  MediaRawType_I420 = 0,      // YYYY YYYY UU   VV  Planar
  MediaRawType_NV12,          // YYYY YYYY UVUV     Semi-Planar
  MediaRawType_NV21,          // YYYY YYYY VUVU     Semi-Planar
  MediaRawType_S16,           // LRLRLRLR LRLRLRLR  Packed
  MediaRawType_S16P,          // LLLLLLLL RRRRRRRR  Planar
};


//结构体 媒体数据
typedef struct ST_MediaFrame : public IBasic {
  MediaType type = MediaType_Video;

  uint8_t *pData[3] = {nullptr, nullptr, nullptr};
  int32_t lineSize[3] = {0};

  MediaRawType rawType = MediaRawType_I420;

  const char *getClassName() override {
    return "MediaFrame";
  }

  void toString() override {
    LOG_TEST("MediaFrame(type:%s, rawType:%s)",
             Media_TypeName(type),
             Media_RawTypeName(rawType))
  }
} MediaFrame;

//音频输出、渲染时的默认参数
#define AUDIO_SAMPLE_FMT  AV_SAMPLE_FMT_S16   //音频采样格式
#define AUDIO_NB_SAMPLES  1024                //音频采样点
#define AUDIO_SAMPLE_RATE 44100               //音频采样率
#define AUDIO_BIT_RATE    64000               //音频码流
#define AUDIO_CHANNEL_NUM 2                   //音频通道

#endif //FPLAYER_MEDIADEFINE_H
